In this paper, algorithms are used to compute distance-based topological indices for the Complete Binary tree (CBT) and the Complete Ternary tree (CTT). Computation of distance-based topological indices is complex for varied heights of CBT and CTT. Hence designed algorithms to compute distance between any-to-any vertex made this possible to compute the required topological indices for CBT and CTT. The distance calculator algorithm designed for this study can also be customized in digital chemical structures, mathematical chemistry, network traffic control in wireless networks, search applications, high bandwidth routing, parse construction in compilers, and memory management.